-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Simplify state held by AbstractSearchAsyncAction a little further #127145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify state held by AbstractSearchAsyncAction a little further #127145
Conversation
Continuing to simplify this a little further: No need to create the throttling CHM unless we actually are throttling, we can use the `null` to signal yes/no here. Likewise, no need to have an extra mutex field on the failures reference, we can use the set-once reference. Lastly, push down the building of the PIT id to the single place where it's actually used, that way we also save the transport version field that's only used in the PIT action on the parent class.
|
Pinging @elastic/es-search-foundations (Team:Search Foundations) |
|
|
||
| protected final void performPhaseOnShard(final int shardIndex, final SearchShardIterator shardIt, final SearchShardTarget shard) { | ||
| if (throttleConcurrentRequests) { | ||
| var pendingExecutionsPerNode = this.pendingExecutionsPerNode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why assign this to a local variable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still faster than repeatedly accessing a field https://openjdk.org/jeps/8349536 :) Doesn't matter too much here, but I had a follow-up planned where some of these fields stop being final and get nulled out. I code up a bigger change and then break pieces out of it for review :) and while it's sort of an irrelelvant line here it avoids some git-history-churn and a trivial amount of CPU/memory work doing it this way I guess :D
benchaplin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks - looks good!
|
Thanks Ben! |
💔 Backport failed
You can use sqren/backport to manually backport by running |
Continuing to simplify this a little further:
No need to create the throttling CHM unless we actually are throttling, we can use the
nullto signal yes/no here.Likewise, no need to have an extra mutex field on the failures reference, we can use the set-once reference.
Lastly, push down the building of the PIT id to the single place where it's actually used, that way we also save the transport version field that's only used in the PIT action on the parent class.